local M = {}
local ui = require("modules.app-launcher.ui")
local hotkeys = require("modules.app-launcher.hotkeys")
local config = require("config.apps")

function M.init()
    -- 创建应用启动回调函数
    local function launchApp(app)
        print("Launching app:", app.name) -- 调试信息
        if app and app.path then
            print("Launching path:", app.path) -- 添加更多调试信息
            hs.application.launchOrFocus(app.path)
        else
            print("Invalid app data:", app) -- 错误调试
        end
    end

    -- 绑定主热键
    hs.hotkey.bind({"alt"}, "2", function()
        ui.showLauncher(launchApp)
        -- 设置应用快捷键
        hotkeys.setupHotkeys()
    end)
end

return M